home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4005 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.8 KB

  1. Path: newsfeed.internetmci.com!xmission!news
  2. From: tknarr@xmission.com  ( Todd Knarr )
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: Hungarian notation
  5. Date: 27 Jan 1996 04:13:39 GMT
  6. Organization: Chaos Central
  7. Message-ID: <4ec8pj$ui@news.xmission.com>
  8. References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com> <3104bfc8.132251392@nntp.ix.netcom.com> <dewar.822407919@schonberg> <3106260f.224013120@nntp.ix.netcom.com> <4e6oj9$o02@news.xmission.com> <31077335.52859072@nntp.ix.netcom.com>
  9. Reply-To: tknarr@xmission.com ( Todd Knarr )
  10. NNTP-Posting-Host: slc48.xmission.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <31077335.52859072@nntp.ix.netcom.com>, miker3@ix.netcom.com (Mike Rubenstein) writes:
  14. >tknarr@xmission.com  ( Todd Knarr ) wrote:
  15. >
  16. >> In <3106260f.224013120@nntp.ix.netcom.com>, miker3@ix.netcom.com (Mike Rubenstein) writes:
  17. >> >    When a value with integral type is demoted to a signed integer
  18. >> >    with smaller size or an unsigned integer is converted to its 
  19. >> >    corresponding signed integer, if the value cannot be 
  20. >> >    represented the result is implementation defined.
  21.  
  22. >What am I reading into the standard that's not there?  Nothing in my
  23. >post suggests that defining the result as always 0 is illegal.  In
  24. >fact, it is clearly legal.
  25. >
  26. >But the standard does impose some restrictions on the definition.  The
  27. >definition must specify that the subject type is converted to the
  28.                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  29. >object type.  It must not produce side-effects.
  30.  ^^^^^^^^^^^
  31.  
  32. The underlined part is what you are reading into the standard. The
  33. standard says only that this must occur *if* the value of the subject
  34. is representable in the result's type. It does not say that the conversion
  35. must occur if the subject is not representable in the result's type, nor
  36. does it place any restrictions on what the implementation may do in this
  37. case. It definitely does not state that the implementation's definition
  38. may not have side-effects.
  39.  
  40. Consider a theoretical machine designed for maximum performance rather
  41. than reasonableness, where variables are stored in different types of
  42. memory depending on their size and where attempting to convert a 32-bit
  43. integer to a 16-bit integer causes a machine check if the high 16 bits
  44. are not all zeros. Tell me which part of the C standard prohibits a C
  45. compiler from crashing the entire machine if I store hex 7FFFFFFF into a
  46. 32-bit long and attempt to convert it to a 16-bit short.
  47.  
  48. --
  49. Todd Knarr : tknarr@xmission.com      |  finger for PGP public key
  50.                                       |  Member, USENET Cabal
  51.  
  52. Seriously, I don't want to die just yet.  I don't care how
  53. good-looking they are, I! don't! want! to! die!"
  54.                                         -- Megazone ( UF1 )
  55.  
  56.